﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>菜单</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="//unpkg.com/layui@2.9.20/dist/css/layui.css" rel="stylesheet">
</head>
<body>
    <div class="layui-layout layui-layout-admin">
        <div class="layui-header">
            <div class="layui-logo layui-hide-xs layui-bg-black"><b>苦糖果MES</b></div>
            <!-- 头部区域（可配合layui 已有的水平导航） -->
            <ul class="layui-nav layui-layout-left">
                <!-- 移动端显示 -->
                <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-header-event="menuLeft">
                    <i class="layui-icon layui-icon-spread-left"></i>
                </li>
            </ul>
            <ul class="layui-nav layui-layout-right">
                <li>
                    <div id="test">123</div>
                </li>
            </ul>
        </div>
        <div class="layui-side layui-bg-black">
            <div class="layui-side-scroll">
                <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
                <ul class="layui-nav layui-nav-tree" lay-filter="test">
                    <li class="layui-nav-item layui-nav-itemed">
                        <a class="" href="javascript:;">首页</a>
                    </li>
                    <li class="layui-nav-item">
                        <a href="javascript:;">RBAC</a>
                        <dl class="layui-nav-child">
                            <dd>
                                <a href="javascript:;">权限管理</a>
                                <dl class="layui-nav-child">
                                    <dd><a href="#" onclick="setIFrame(0)">权限添加</a></dd>
                                    <dd><a href="#" onclick="setIFrame(1)">权限列表</a></dd>
                                </dl>
                            </dd>
                            <dd>
                                <a href="javascript:;">角色管理</a>
                                <dl class="layui-nav-child">
                                    <dd><a href="#" onclick="setIFrame(2)">角色添加</a></dd>
                                    <dd><a href="#" onclick="setIFrame(3)">角色列表</a></dd>
                                </dl>
                            </dd>
                            <dd>
                                <a href="javascript:;">用户管理</a>
                                <dl class="layui-nav-child">
                                    <dd><a href="#" onclick="setIFrame(4)">用户添加</a></dd>
                                    <dd><a href="#" onclick="setIFrame(5)">用户列表</a></dd>
                                </dl>
                            </dd>
                        </dl>
                    </li>
                    <li class="layui-nav-item">
                        <a href="javascript:;">主数据</a>
                        <dl class="layui-nav-child">
                            <dd>
                                <a href="#" onclick="setIFrame(21)">物料产品管理</a>
                            </dd>
                            <dd>
                                <a href="#" onclick="setIFrame(6)">物料产品分类</a>
                            </dd>
                            <dd>
                                <a href="#" onclick="setIFrame(7)">供应商管理</a>
                            </dd>
                            <dd>
                                <a href="#" onclick="setIFrame(12)">系统日志</a>
                            </dd>
                            <dd>
                                <a href="#" onclick="setIFrame(24)">待检任务</a>
                            </dd>
                            <dd>
                                <a href="#" onclick="setIFrame(27)">采购入库</a>
                            </dd>
                        </dl>
                    </li>
                    <li class="layui-nav-item">
                        <a href="javascript:;">生产管理</a>
                        <dl class="layui-nav-child">
                            <dd>
                                <a href="#" onclick="setIFrame(23)">生产工单</a>
                            </dd>
                            <dd>
                                <a href="#">工艺路线</a>
                                <dl class="layui-nav-child">
                                    <dd><a href="#" onclick="setIFrame(20)">工艺路线列表</a></dd>
                                </dl>
                            </dd>
                            <dd>
                                <a href="#">采购入库</a>
                                <dl class="layui-nav-child">
                                    <dd><a href="#" onclick="setIFrame(22)">采购入库列表</a></dd>
                                </dl>
                            </dd>
                            <dd>
                                <a href="#">客户管理</a>
                                <dl class="layui-nav-child">
                                    <dd><a href="#" onclick="setIFrame(19)">客户管理列表</a></dd>
                                </dl>
                            </dd>
                            <dd>
                                <a href="#">工序管理</a>
                                <dl class="layui-nav-child">
                                    <dd><a href="#" onclick="setIFrame(13)">工序添加</a></dd>
                                    <dd><a href="#" onclick="setIFrame(14)">工序列表</a></dd>
                                </dl>
                            </dd>
                            <dd>
                                <a href="#" onclick="setIFrame(99)">生产报工</a>
                            </dd>
                            <dd>
                                <a href="#" onclick="setIFrame(25)">生产排产</a>
                            </dd>
                            <dd>
                                <a href="#" onclick="setIFrame(26)">转移调拨</a>
                            </dd>
                            <dd>
                                <a href="#" onclick="setIFrame(28)">生产领料</a>
                            </dd>
                            <dd>
                                <a href="#" onclick="setIFrame(29)">生产退料</a>
                            </dd>
                            <dd>
                                <a href="#" onclick="setIFrame(30)">到货通知</a>
                            </dd>
                        </dl>
                    </li>
                    <li class="layui-nav-item">
                        <a href="javascript:;">企业管理</a>
                        <dl class="layui-nav-child">
                            <dd>
                                <a href="#">企业管理</a>
                                <dl class="layui-nav-child">
                                    <dd><a href="#" onclick="setIFrame(16)">企业添加</a></dd>
                                    <dd><a href="#" onclick="setIFrame(15)">企业列表</a></dd>
                                </dl>
                            </dd>
                            <dd>
                                <a href="#">部门管理</a>
                                <dl class="layui-nav-child">
                                    <dd><a href="#" onclick="setIFrame(18)">部门添加</a></dd>
                                    <dd><a href="#" onclick="setIFrame(17)">部门列表</a></dd>
                                </dl>
                            </dd>
                        </dl>
                    </li>
                    <li class="layui-nav-item">
                        <a href="javascript:;">仓储管理</a>
                        <dl class="layui-nav-child">
                            <dd>
                                <a href="javascript:;">仓库管理</a>
                                <dl class="layui-nav-child">
                                    <dd><a href="#" onclick="setIFrame(10)">仓库添加</a></dd>
                                    <dd><a href="#" onclick="setIFrame(11)">仓库列表</a></dd>
                                </dl>
                            </dd>
                            <dd>
                                <a href="#" onclick="setIFrame(8)">销售出库</a>
                            </dd>
                            <dd>
                                <a href="#" onclick="setIFrame(78)">赋码管理</a>
                            </dd>
                            <dd>
                                <a href="#" onclick="setIFrame(79)">生产领料</a>
                            </dd>
                            <dd>
                                <a href="#" onclick="setIFrame(80)">生产退料</a>
                            </dd>
                         @*    <dd>
                                <a href="#" onclick="setIFrame(81)">到货通知</a>
                            </dd> *@
                        </dl>
                    </li>
                </ul>
            </div>
        </div>
        <div class="layui-body">
            <!-- 内容主体区域 -->
            <div style="padding: 15px;">
                @*  <blockquote class="layui-elem-quote layui-text">
                Layui 框体布局内容主体区域
                </blockquote> *@
                <div class="layui-card layui-panel">
                    <div class="layui-card-body">
                        <iframe src="" id="iframeShow" width="100%" height="800px"  frameborder="no" border="0"></iframe>
                    </div>
                </div>
                <br><br>
            </div>
        </div>
    </div>

    <script src="//unpkg.com/layui@2.9.20/dist/layui.js"></script>
    <script>
        var $ = layui.$;

        function setIFrame(flag) {
            switch (flag) {
                case 0: //权限添加
                    $("#iframeShow").attr("src", "/Menu/PerpossionCreate");
                    break;
                case 1: //权限列表
                    $("#iframeShow").attr("src", "/Menu/PerpossionList");
                    break;
                case 2: //角色添加
                    $("#iframeShow").attr("src", "/Menu/RolesCreateView");
                    break;
                case 3: //角色列表
                    $("#iframeShow").attr("src", "/Menu/RolesListView");
                    break;
                case 4: //用户添加UserListView
                    $("#iframeShow").attr("src", "/Menu/UserCreateView");
                    break;
                case 5: //用户添加UserListView
                    $("#iframeShow").attr("src", "/Menu/UserListView");
                    break;
                case 6: //物料产品分类
                    $("#iframeShow").attr("src", "/Messages/ProductTypeShow");
                    break;
                case 7: //供应商列表
                    $("#iframeShow").attr("src", "/Supplier/SupplierSearch");
                    break;
                case 8: //销售出库
                    $("#iframeShow").attr("src", "/SellStock/SellStockSearch");
                    break;
                case 9: //物料产品分类
                    $("#iframeShow").attr("src", "/Supplier/SupplierSearch");
                    break;
                case 10: //仓库添加
                    $("#iframeShow").attr("src", "/Document/StashAdd");
                    break;
                case 11: //仓库列表
                    $("#iframeShow").attr("src", "/Document/Index");
                    break;
                case 12: //日志
                    $("#iframeShow").attr("src", "/Document/Loginhtml");
                    break;
                case 13: //工序列表
                    $("#iframeShow").attr("src", "/Document/processhtml");
                    break;
                case 14: //工序添加
                    $("#iframeShow").attr("src", "/Document/ProcessAdds");
                    break;
                case 15: //企业列表
                    $("#iframeShow").attr("src", "/Enterprise/EnterpriseList");
                    break;
                case 16: //企业添加
                    $("#iframeShow").attr("src", "/Enterprise/EnterpriseAdd");
                    break;
                case 17: //部门列表
                    $("#iframeShow").attr("src", "/Enterprise/DepartmentList");
                    break;
                case 18: //部门添加
                    $("#iframeShow").attr("src", "/Enterprise/DepartmentAdd");
                    break;
                case 19: //客户管理
                    $("#iframeShow").attr("src", "/Enterprise/ClientManagementList");
                    break;
                case 20: //工艺路线显示
                    $("#iframeShow").attr("src", "/Enterprise/CraftRouteList");
                    break;
                case 21: //物料产品管理 列表
                    $("#iframeShow").attr("src", "/Messages/ProductmanageShow");
                    break;
                case 22: //采购入库 列表
                    $("#iframeShow").attr("src", "/Enterprise/PurchaseStorageList");
                    break;
                case 23: //生产工单
                    $("#iframeShow").attr("src", "/Translation/ProductionWorkOrders");
                    break;
                case 24: //待检任务
                    $("#iframeShow").attr("src", "/Translation/ToBeInspected");
                    break;
                case 25: //生产排产
                    $("#iframeShow").attr("src", "/Document/ProceHtmlSchedulings");
                    break;
                case 26: //转移调拨单
                    $("#iframeShow").attr("src", "/Document/DiversionView");
                    break;
                case 27: //转移调拨单
                    $("#iframeShow").attr("src", "/Enterprise/PurchaseStorageList");
                    break;
                case 28: //生产领料
                    $("#iframeShow").attr("src", "/Messages/PickingsLists");
                    break;
                case 29: //生产领料
                    $("#iframeShow").attr("src", "/Messages/StrippingLists");
                    break;
                case 30: //生产领料
                    $("#iframeShow").attr("src", "/Messages/ArrivalNoticesList");
                    break;
                case 99: //生产报工
                    $("#iframeShow").attr("src", "/Production/ProductionWorkSearch");
                    break;
                case 78: //生产报工
                    $("#iframeShow").attr("src", "/QUCode/QUCodeSearch");
                    break;
                case 79: //生产领料
                    $("#iframeShow").attr("src", "/Messages/PickingsLists");
                    break;
                case 80: //生产退料
                    $("#iframeShow").attr("src", "/Messages/StrippingLists");
                    break;
                // case 81: //到货通知
                //     $("#iframeShow").attr("src", "/Messages/ArrivalNoticesList");
                //     break;
            }
        }

        //JS
        layui.use(['form', 'element', 'layer', 'util'], function () {
            var element = layui.element;
            var form = layui.form;
            var layer = layui.layer;
            var util = layui.util;
            var $ = layui.$;
            var obj = JSON.parse(localStorage.getItem("userName"));
            console.log(obj)

            if (obj != null) {
                $('#test').html(` <div class="layui-nav" lay-filter="demo-filter-nav">
                                    <form class="layui-form" action="" width="100">
                                        欢迎您！${obj.userName}
                                        <button type="submit" class="layui-btn" lay-submit lay-filter="demo2">退出</button>
                                    </form>
                                </div>
                                `);
            } else {
                $('#test').html(`
                                <div class="layui-nav" lay-filter="demo-filter-nav">
                                    <form class="layui-form" action="">
                                        <button type="submit" class="layui-btn" lay-submit lay-filter="demo1">登录</button>
                                    </form>
                                </div>
                                `);
            }
            // 渲染导航组件
            element.render('nav', 'test');

            form.on('submit(demo2)', function () {
                localStorage.removeItem("userName");
                console.log(1231);
                element.render('nav', 'demo-filter-nav');
                //return false; // 阻止默认 form 跳转
            })
            form.on('submit(demo1)', function () {
                localStorage.removeItem("userName");
                location.href = '@ViewBag.MVCIp' + "/Menu/Login";
                return false; // 阻止默认 form 跳转
            })
        });


    </script>
</body>
</html>
